//
//  QZMyMessegeView.m
//  shortvideoplay
//
//  Created by tikeios_002 on 2024/6/19.
//

#import "QZMyMessegeView.h"
#import "MyBtton.h"
#import "TLDisplayView.h"
#import "YYLabel.h"
#import "NSAttributedString+YYText.h"
@interface QZMyMessegeView ()<TLDisplayViewDelegate>
@property(assign, nonatomic) BOOL isOpenIntro;
@end
@implementation QZMyMessegeView
{

    UILabel * nick;
    UIImageView * creator_image;
    UILabel * creator_name;
    UIImageView * creator_more_image;
    UIButton * creator_rengzheng;
    UIView * footView;
    UIView * likeView;
    UILabel * likeNumber;
    UILabel * likeTip;
    UIView * fansView;
    UILabel * fansNumber;
    UILabel * fansTip;
    UIView * followsView;
    UILabel * followsNumber;
    UILabel * followsTip;
    
    UIView * yaoqingView;
    UILabel * yaoqingNumber;
    UILabel * yaoqingTip;
    //    TLDisplayView * displayView;
    UIButton * displayInput;
    YYLabel * displayView;
    UIStackView * labelsView;
    UILabel * add;
    UILabel * addImage;
    UIView * addView;
    UILabel * age;
    UIView * ageView;
    UILabel * adress;
    UIView * adressView;
    UILabel * sexAge;
    UIImageView * sexAgeImage;
    UIView * sexAndAgeView;
    UIImageView * sexImage;
    UIView *sexView;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _background = [UIImageView new];
        _background.contentMode = UIViewContentModeScaleAspectFill;
        _background.clipsToBounds = YES;
        [self addSubview:_background];
        
        UIButton * backButton = [[UIButton alloc]init];
        [backButton setTitle:@"" forState:UIControlStateNormal];
        [backButton addTarget:self action:@selector(backTap) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:backButton];
        
        _face = [UIImageView new];
        _face.contentMode = UIViewContentModeScaleAspectFill;
        _face.layer.cornerRadius = 41;
        _face.clipsToBounds = YES;
        [self addSubview:_face];
        UIButton * faceButton = [[UIButton alloc]init];
        [faceButton setTitle:@"" forState:UIControlStateNormal];
        faceButton.layer.cornerRadius = 41;
        [faceButton addTarget:self action:@selector(faceTap) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:faceButton];
        
        nick = [[UILabel alloc]init];
        nick.font = FontBold(16);
        nick.textColor = [UIColor whiteColor];
        [self addSubview:nick];
        
        creator_image = [[UIImageView alloc]init];
        creator_image.image = KImageNamed(@"chuangzuozhe");
        creator_image.hidden = YES;
        [self addSubview:creator_image];
        
        creator_name = [[UILabel alloc]init];
        creator_name.font = Font(14);
        creator_name.textColor = [UIColor whiteColor];
        creator_name.hidden = YES;
        [self addSubview:creator_name];
        
        creator_more_image = [[UIImageView alloc]init];
        creator_more_image.image = KImageNamed(@"ico_more_wite");
        creator_more_image.hidden = YES;
        [self addSubview:creator_more_image];
        
        creator_rengzheng = [[UIButton alloc]init];
        [creator_rengzheng addTarget:self action:@selector(rengzhengTap) forControlEvents:UIControlEventTouchUpInside];
        creator_rengzheng.hidden = YES;
        [self addSubview:creator_rengzheng];
        
        
        footView = [UIView new];
        footView.backgroundColor = viewback_black;
        footView.layer.cornerRadius = 15;
        footView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
        [self addSubview:footView];
        
        likeView = [[UIView alloc]init];
        [footView addSubview:likeView];
        
        likeNumber = [[UILabel alloc]init];
        likeNumber.font = FontBold(16);
        likeNumber.textColor = [UIColor whiteColor];
        [likeView addSubview:likeNumber];
        
        likeTip = [[UILabel alloc]init];
        likeTip.font = Font(12);
        likeTip.textColor = COLOR_ALPH(255, 255, 255, 0.72);
        [likeView addSubview:likeTip];
        
        fansView = [[UIView alloc]init];
        [footView addSubview:fansView];
        
        fansNumber = [[UILabel alloc]init];
        fansNumber.font = FontBold(16);
        fansNumber.textColor = [UIColor whiteColor];
        [fansView addSubview:fansNumber];
        
        fansTip = [[UILabel alloc]init];
        fansTip.font = Font(12);
        fansTip.textColor = COLOR_ALPH(255, 255, 255, 0.72);
        [fansView addSubview:fansTip];
        
        followsView = [[UIView alloc]init];
        [footView addSubview:followsView];
        
        followsNumber = [[UILabel alloc]init];
        followsNumber.font = FontBold(16);
        followsNumber.textColor = [UIColor whiteColor];
        [followsView addSubview:followsNumber];
        
        followsTip = [[UILabel alloc]init];
        followsTip.font = Font(12);
        followsTip.textColor = COLOR_ALPH(255, 255, 255, 0.72);
        [followsView addSubview:followsTip];
        
        yaoqingView = [[UIView alloc]init];
        [footView addSubview:yaoqingView];
        
        yaoqingNumber = [[UILabel alloc]init];
        yaoqingNumber.font = FontBold(16);
        yaoqingNumber.textColor = [UIColor whiteColor];
        [yaoqingView addSubview:yaoqingNumber];
        
        yaoqingTip = [[UILabel alloc]init];
        yaoqingTip.font = Font(12);
        yaoqingTip.textColor = COLOR_ALPH(255, 255, 255, 0.72);
        [yaoqingView addSubview:yaoqingTip];
        
        displayView = [[YYLabel alloc] init];
        //        [displayView setText:@"新浪2微博(www.weibo.com)在美国纳斯达克正式挂牌上asdasdasd市了！新浪2微博(www.weibo.com)在美国纳斯达克正式挂牌上asdasdasd市了！新浪2微博(www.weibo.com)在美国纳斯达克正式挂牌上asdasdasd市了！新浪2微博(www.weibo.com)在美国纳斯达克正式挂牌上asdasdasd市了！新浪2微博(www.weibo.com)在美国纳斯达克正式挂牌上asdasdasd市了！新浪2微博(www.weibo.com)在美国纳斯达克正式挂牌上asdasdasd市了！"];
        //        displayView.delegate = self;
        //        displayView.backgroundColor = [UIColor blackColor];
        displayView.textColor= [UIColor whiteColor];
        //        displayView.textColor = COLOR_ALPH(255, 255, 255, 0.91);
        displayView.numberOfLines = 2;
        //        [displayView setOpenString:@"［查看更多］" closeString:@"［点击收起］" font:[UIFont systemFontOfSize:14] textColor:[UIColor whiteColor]];
        [footView addSubview:displayView];
        
        displayInput = [[UIButton alloc]init];
        [displayInput setTitle:@"点击添加个性签名，让更多人认识你..." forState:UIControlStateNormal];
        [displayInput setImage:KImageNamed(@"ic_my_intro_edit") forState:UIControlStateNormal];
        displayInput.titleLabel.font = Font(14);
        [displayInput addTarget:self action:@selector(displayInputTap) forControlEvents:UIControlEventTouchUpInside];
        [footView addSubview:displayInput];
        
        labelsView = [[UIStackView alloc]init];
        labelsView.axis = UILayoutConstraintAxisHorizontal;
        labelsView.spacing = 10;
        labelsView.alignment = UIStackViewAlignmentFill;
        [footView addSubview:labelsView];
        
        sexView = [[UIView alloc]init];
        sexView.backgroundColor = COLOR_ALPH(255, 255, 255, 0.22);
        sexView.layer.cornerRadius = 3;
        sexView.clipsToBounds = YES;
        [labelsView addArrangedSubview:sexView];
        
        sexImage = [[UIImageView alloc]init];
        sexImage.image = KImageNamed(@"ic_sex_boy");
        [sexView addSubview:sexImage];
        
        sexAndAgeView = [[UIView alloc]init];
        sexAndAgeView.backgroundColor = COLOR_ALPH(255, 255, 255, 0.22);
        sexAndAgeView.layer.cornerRadius = 3;
        sexAndAgeView.clipsToBounds = YES;
        [labelsView addArrangedSubview:sexAndAgeView];
        
        sexAgeImage = [[UIImageView alloc]init];
        sexAgeImage.image = KImageNamed(@"ic_sex_boy");
        [sexAndAgeView addSubview:sexAgeImage];
        
        sexAge = [[UILabel alloc]init];
        sexAge.font = Font(12);
        sexAge.textColor = [UIColor whiteColor];
        [sexAndAgeView addSubview:sexAge];
        
        ageView = [[UIView alloc]init];
        ageView.backgroundColor = COLOR_ALPH(255, 255, 255, 0.22);
        ageView.layer.cornerRadius = 3;
        ageView.clipsToBounds = YES;
        [labelsView addArrangedSubview:ageView];
        
        age = [[UILabel alloc]init];
        age.font = Font(12);
        age.textColor = [UIColor whiteColor];
        [sexView addSubview:age];
        
        adressView = [[UIView alloc]init];
        adressView.backgroundColor = COLOR_ALPH(255, 255, 255, 0.22);
        adressView.layer.cornerRadius = 3;
        adressView.clipsToBounds = YES;
        [labelsView addArrangedSubview:adressView];
        
        adress = [[UILabel alloc]init];
        adress.font = Font(12);
        adress.textColor = [UIColor whiteColor];
        [adressView addSubview:adress];
        
        
        addView = [[UIView alloc]init];
        addView.backgroundColor = COLOR_ALPH(255, 255, 255, 0.22);
        addView.layer.cornerRadius = 3;
        addView.clipsToBounds = YES;
        [labelsView addArrangedSubview:addView];
        
        add = [[UILabel alloc]init];
        add.font = Font(12);
        add.textColor = [UIColor whiteColor];
        [addView addSubview:add];
        
        addImage = [[UILabel alloc]init];
        addImage.font = FontBold(18);
        addImage.textAlignment = NSTextAlignmentCenter;
        addImage.textColor = [UIColor whiteColor];
        addImage.text = @"+";
        [addView addSubview:addImage];
        
    
        
        [_background mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.right.mas_offset(0);
            make.bottom.mas_offset(-50);
        }];
        [backButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_offset(KNav_H);
            make.left.top.right.mas_offset(0);
            make.bottom.mas_offset(-50);
        }];
        
        [_face mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(15);
            make.top.mas_offset(KNav_H+28);
            make.width.height.mas_offset(82);
        }];
        [faceButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(15);
            make.top.mas_offset(KNav_H+28);
            make.width.height.mas_offset(82);
        }];
        
        [nick mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_face.mas_right).mas_offset(10);
            make.right.mas_lessThanOrEqualTo(-15);
            make.centerY.equalTo(_face).mas_offset(0);
            make.height.mas_offset(22);
        }];
        
        [creator_image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_face.mas_right).mas_offset(10);
            make.right.mas_lessThanOrEqualTo(-15);
            make.top.equalTo(nick.mas_bottom).mas_offset(10);
            make.width.height.mas_offset(14);
        }];
        
        [creator_name mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(creator_image.mas_right).mas_offset(5);
            make.right.mas_lessThanOrEqualTo(-15);
            make.centerY.equalTo(creator_image).mas_offset(0);
            make.height.mas_offset(22);
        }];
        
        [creator_more_image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(creator_name.mas_right).mas_offset(5);
            make.centerY.equalTo(creator_image).mas_offset(0);
            make.width.height.mas_offset(12);
        }];
        
        [creator_rengzheng mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(creator_image.mas_left).mas_offset(0);
            make.right.equalTo(creator_more_image.mas_right).mas_offset(0);
            make.centerY.equalTo(creator_image).mas_offset(0);
            make.height.mas_offset(26);
        }];
        
        [footView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_face.mas_bottom).mas_offset(20);
            make.left.right.bottom.mas_offset(0);
        }];
        
        [likeView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(15);
            make.top.mas_offset(15);
            make.height.mas_offset(30);
        }];
        
        [likeNumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.left.mas_offset(0);
        }];
        [likeTip mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(likeNumber.mas_right).mas_offset(2);
            make.top.mas_offset(4);
            make.bottom.right.mas_offset(0);
        }];
        
        [followsView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(likeView.mas_right).mas_offset(15);
            make.top.mas_offset(15);
            make.height.mas_offset(30);
        }];
        [followsNumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.left.mas_offset(0);
        }];
        [followsTip mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(followsNumber.mas_right).mas_offset(2);
            make.top.mas_offset(4);
            make.bottom.right.mas_offset(0);
        }];
        
        [fansView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(followsView.mas_right).mas_offset(15);
            make.top.mas_offset(15);
            make.height.mas_offset(30);
        }];
        [fansNumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.left.mas_offset(0);
        }];
        [fansTip mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(fansNumber.mas_right).mas_offset(2);
            make.top.mas_offset(4);
            make.bottom.right.mas_offset(0);
        }];
        
        [yaoqingView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(fansView.mas_right).mas_offset(15);
            make.top.mas_offset(15);
            make.height.mas_offset(30);
        }];
        [yaoqingNumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.left.mas_offset(0);
        }];
        [yaoqingTip mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(yaoqingNumber.mas_right).mas_offset(2);
            make.top.mas_offset(4);
            make.bottom.right.mas_offset(0);
        }];
        
        [displayView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(15);
            make.right.mas_offset(-15);
            make.top.equalTo(likeView.mas_bottom).mas_offset(12);
            make.height.mas_greaterThanOrEqualTo(20);
        }];
        [displayInput mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(15);
            make.right.mas_lessThanOrEqualTo(-15);
            make.top.equalTo(likeView.mas_bottom).mas_offset(12);
            make.height.mas_offset(20);
        }];
        
        [labelsView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(displayView.mas_bottom).mas_offset(12);
            make.left.mas_offset(15);
            make.right.mas_lessThanOrEqualTo(-15);
            make.height.mas_offset(19);
        }];
        [sexImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(6);
            make.right.mas_offset(-6);
            make.top.mas_offset(3);
            make.width.height.mas_offset(13);
        }];
        
        [sexAgeImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(6);
            make.top.mas_offset(3);
            make.width.height.mas_offset(13);
        }];
        [sexAge mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(sexAgeImage.mas_right).mas_offset(4);
            make.right.mas_offset(-6);
            make.top.bottom.mas_offset(0);
        }];
        [age mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(6);
            make.right.mas_offset(-6);
            make.top.bottom.mas_offset(0);
        }];
        [adress mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(6);
            make.right.mas_offset(-6);
            make.top.bottom.mas_offset(0);
        }];
        
//        [addView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.edges.mas_offset(0);
//        }];
        [addImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_offset(0);
            make.top.bottom.mas_offset(0);
            make.width.mas_offset(18);
        }];
        
        [add mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(addImage.mas_right).mas_offset(0);
            make.right.mas_offset(-6);
            make.top.bottom.mas_offset(0);
        }];
        
        likeTip.text = @"获赞";
        fansTip.text = @"粉丝";
        followsTip.text = @"关注";
        yaoqingTip.text = @"邀请";
        _background.image = KImageNamed(@"ic_user_bgimage");
        _face.image = KImageNamed(@"ic_head_defuls");
        
        likeView.tag = 1;
        [likeView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(likeTap:)]];
        followsView.tag = 2;
        [followsView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(likeTap:)]];
        fansView.tag = 3;
        [fansView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(likeTap:)]];
        yaoqingView.tag = 4;
        [yaoqingView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(likeTap:)]];
        
        NSMutableAttributedString * moreAttr = [[NSMutableAttributedString alloc] initWithString:@"... 查看更多" attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : Font(14)}];
        KWeakSelf
        [moreAttr setTextHighlightRange:NSMakeRange(0, moreAttr.length) color:[UIColor whiteColor] backgroundColor:UIColor.clearColor tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
            //点击
            weakSelf.isOpenIntro = YES;
            weakSelf.myMessegeHeaderBlock(0);
        }];
        
        YYLabel *moreLabel = [YYLabel new];
        moreLabel.backgroundColor = UIColor.clearColor;
        moreLabel.attributedText = moreAttr;
        [moreLabel sizeToFit];
        NSAttributedString * truncationToken = [NSAttributedString attachmentStringWithContent:moreLabel contentMode:UIViewContentModeScaleAspectFit attachmentSize:moreLabel.frame.size alignToFont:Font(14) alignment:YYTextVerticalAlignmentCenter];
        displayView.truncationToken = truncationToken;
    UIButton * textShowButtonTo1 = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
        NSString * textShowButtonTitleTo1 = @"测试功能";
        [textShowButtonTo1 setTitle:textShowButtonTitleTo1 forState:UIControlStateNormal];
        NSInteger textShowArcTo1 = arc4random_uniform(22);
        NSLog(@"随机数：%ld", (long)textShowArcTo1);
        _background.hidden = YES;
        _face.hidden = YES;
        nick.hidden = YES;
        labelsView.hidden = YES;
        displayInput.hidden = YES;
        displayView.hidden = YES;
        likeView.hidden = YES;
        fansView.hidden = YES;
        followsView.hidden = YES;
        yaoqingView.hidden = YES;
    }
    return self;
}
- (void)refreshMessege{
    _background.hidden = NO;
    _face.hidden = NO;
    nick.hidden = NO;
    labelsView.hidden = NO;
    likeView.hidden = NO;
    fansView.hidden = NO;
    followsView.hidden = NO;
    if([[QZUserInfoModel share].invite_switch intValue] == 1){
        yaoqingView.hidden = NO;
    }

    
    [_background sd_setImageWithURL:KUrlString([QZUserInfoModel share].back_image) placeholderImage:_background.image];
    [_face sd_setImageWithURL:KUrlString([QZUserInfoModel share].face) placeholderImage:_face.image];
    nick.text = [QZUserInfoModel share].nickname;
    NSLog(@"%@",[QZUserInfoModel share].creator_attestation);
    if([[QZUserInfoModel share].creator_attestation count] != 0 && [[QZUserInfoModel share].creator_attestation[@"ischeck"] intValue] == 1){
        creator_name.hidden = NO;
        creator_image.hidden = NO;
        creator_more_image.hidden = YES;
        creator_rengzheng.hidden = YES;
        creator_name.text = [QZUserInfoModel share].creator_attestation[@"creator_name"];
        [nick mas_updateConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(_face).mas_offset(-15);
        }];
    }else if ([[QZUserInfoModel share].creator_attestation count] != 0 && [[QZUserInfoModel share].creator_attestation[@"ischeck"] intValue] == 2){
        creator_name.hidden = NO;
        creator_image.hidden = NO;
        creator_more_image.hidden = NO;
        creator_rengzheng.hidden = NO;
        creator_name.text = @"认证未通过";
        [nick mas_updateConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(_face).mas_offset(-15);
        }];
    }else if ([[QZUserInfoModel share].creator_attestation count] != 0 && [[QZUserInfoModel share].creator_attestation[@"ischeck"] intValue] == 0){
        creator_name.hidden = NO;
        creator_image.hidden = NO;
        creator_more_image.hidden = NO;
        creator_rengzheng.hidden = NO;
        creator_name.text = @"认证审核中";
        [nick mas_updateConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(_face).mas_offset(-15);
        }];
    }else if ([[QZUserInfoModel share].iscreator intValue] == 1 && [[QZUserInfoModel share].creator_attestation count] == 0){
        creator_name.hidden = NO;
        creator_image.hidden = NO;
        creator_more_image.hidden = NO;
        creator_rengzheng.hidden = NO;
        creator_name.text = @"视频创作未认证";
        [nick mas_updateConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(_face).mas_offset(-15);
        }];
    }else{
        creator_name.hidden = YES;
        creator_image.hidden = YES;
        creator_more_image.hidden = YES;
        creator_rengzheng.hidden = YES;
        [nick mas_updateConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(_face).mas_offset(0);
        }];
    }
    likeNumber.text = [Tools NumberToShowString:[[QZUserInfoModel share].total_like integerValue]];
    followsNumber.text = [Tools NumberToShowString:[[QZUserInfoModel share].total_follow integerValue]];
    fansNumber.text = [Tools NumberToShowString:[[QZUserInfoModel share].total_fans integerValue]];
  
    yaoqingNumber.text = [Tools NumberToShowString:[[QZUserInfoModel share].invite_num integerValue]];
    

    
    NSString * addTip = @"";
    if([[QZUserInfoModel share].sex length] != 0 && [[QZUserInfoModel share].birthday length] != 0){
        sexView.hidden = YES;
        ageView.hidden = YES;
        sexAndAgeView.hidden = NO;
        if([[QZUserInfoModel share].sex isEqualToString:@"男"]){
            sexAgeImage.image = KImageNamed(@"ic_sex_boy");
        }else{
            sexAgeImage.image = KImageNamed(@"ic_sex_girl");
        }
        sexAge.text = [NSString stringWithFormat:@"%@岁",[QZUserInfoModel share].age];
    }else if ([[QZUserInfoModel share].sex length] != 0){
        sexView.hidden = NO;
        ageView.hidden = YES;
        sexAndAgeView.hidden = YES;
        if([[QZUserInfoModel share].sex isEqualToString:@"男"]){
            sexImage.image = KImageNamed(@"ic_sex_boy");
        }else{
            sexImage.image = KImageNamed(@"ic_sex_girl");
        }
        addTip = @"年龄";
    }else if ([[QZUserInfoModel share].birthday length] != 0){
        sexView.hidden = YES;
        ageView.hidden = NO;
        sexAndAgeView.hidden = YES;
        age.text = [NSString stringWithFormat:@"%@岁",[QZUserInfoModel share].age];
        addTip = @"性别";
    }else{
        sexView.hidden = YES;
        ageView.hidden = YES;
        sexAndAgeView.hidden = YES;
        addTip = @"性别，年龄";
    }
    if([[QZUserInfoModel share].area_str length] != 0){
        adressView.hidden = NO;
        adress.text = [QZUserInfoModel share].area_str;
    }else{
        adressView.hidden = YES;
        if(addTip.length != 0){
            addTip = [NSString stringWithFormat:@"%@，地址等",addTip];
        }else{
            addTip = @"地址";
        }
    }
    
    if(addTip.length == 0){
        addView.hidden = YES;
    }else{
        addView.hidden = NO;
        add.text = [NSString stringWithFormat:@"添加%@标签",addTip];
    }
    
    
    if([QZUserInfoModel share].motto.length == 0){
        displayInput.hidden = NO;
        displayView.hidden = YES;
        self.introHeight = 20;
        KWeakSelf
        [displayView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_offset(weakSelf.introHeight);
        }];
    }else{
        //        [displayView setText:[QZUserInfoModel share].motto];
        displayInput.hidden = YES;
        displayView.hidden = NO;
        NSMutableAttributedString * moreAttr = [[NSMutableAttributedString alloc] initWithString:[QZUserInfoModel share].motto attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : Font(14)}];
        KWeakSelf
        if(self.isOpenIntro){
            NSMutableAttributedString * closeAttr = [[NSMutableAttributedString alloc] initWithString:@".... 收起" attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : Font(14)}];
            [closeAttr setTextHighlightRange:NSMakeRange(0, closeAttr.length) color:[UIColor whiteColor] backgroundColor:UIColor.clearColor tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
                //点击
                weakSelf.isOpenIntro = NO;
                weakSelf.myMessegeHeaderBlock(0);
            }];
            [moreAttr appendAttributedString:closeAttr];
            
            displayView.numberOfLines = 0;
            self.introHeight = [moreAttr boundingRectWithSize:CGSizeMake(KScreen_W-32, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil].size.height;
            
        }else{
            displayView.numberOfLines = 2;
            self.introHeight = [moreAttr boundingRectWithSize:CGSizeMake(KScreen_W-32, displayView.font.lineHeight*2) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil].size.height+2;
        }
        displayView.attributedText = moreAttr;
        
        if(self.introHeight < 20){
            self.introHeight = 20;
        }
        [displayView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_offset(weakSelf.introHeight);
        }];
    }
}
#pragma mark -
- (void)likeTap:(UIPanGestureRecognizer*)sender {
    self.myMessegeHeaderBlock(sender.view.tag);
}
- (void)rengzhengTap{
    self.myMessegeHeaderBlock(6);
}
- (void)displayInputTap{
    self.myMessegeHeaderBlock(5);
}
- (void)backTap{
    self.myMessegeHeaderBlock(7);
}
- (void)faceTap{
    self.myMessegeHeaderBlock(8);
}
#pragma mark TLDisplayViewDelegate
- (void)displayView:(TLDisplayView *)label closeHeight:(CGFloat)height {

}

- (void)displayView:(TLDisplayView *)label openHeight:(CGFloat)height {

}

@end
